                    <div class="sidebar r">
                        <div class="sidebox">
                            <div class="sb_hd">
                                <span class="sb_tl"></span>
                                <span class="sb_tr"></span>
                                分类
                            </div>
                            <div class="sb_bd">
                                <ul class="cata">
                                <?php 
                                 $result=mysql_query("select * from type");
                                 while($row=mysql_fetch_array($result)){
                                    ?>
                                   <li>
                                        <a href="catalog.php?cid=<?php echo $row['id'] ?>"><?php echo $row['name'] ?></a>
                                    </li>
                                    <?php
                                    }
                                    ?>
                                </ul>
                            </div>
                        </div>
                        <div class="sidebox">
                            <div class="sb_hd">
                                <span class="sb_tl"></span>
                                <span class="sb_tr"></span>
                                最新评论
                            </div>
                            <div class="sb_bd">
                            
                                <ul class="newComments">
                                <?php
                                   $comment_idx=mysql_query("select c.id,c.aid,c.name,c.cont,c.post_date,i.title from comment as c,info as i where c.aid=i.id and isVal=1 order by id desc limit 5");
                                   while($comment_row=mysql_fetch_array($comment_idx)){
                                ?>
                                    <li>
                                        <?php echo $comment_row['name']; ?>@<a href="show.php?pid=<?php echo $comment_row['aid']; ?>#comments_<?php echo $comment_row['id']; ?>"><?php echo $comment_row['title']; ?></a>
                                        <p><?php echo $comment_row['cont']; ?></p>
                                    </li>
                                    <?php }    ?>

                                </ul>
                            </div>
                        </div>
                        <div class="sidebox">
                            <div class="sb_hd">
                                <span class="sb_tl"></span>
                                <span class="sb_tr"></span>
                                友情链接
                            </div>
                            <div class="sb_bd">
                                <ul>
                                <?php
                                $result_link=mysql_query("select * from link order by id asc");
                                while($row_link=mysql_fetch_array($result_link)){
                                ?>
                                    <li>
                                        <a href="<?php echo $row_link['url'];?>" target="_blank"  title="<?php echo $row_link['desc'];?>"><?php echo $row_link['name'];?></a>
                                    </li>
                                    <?php }?>
                                </ul>
                            </div>
                        </div>
                    </div>
                   